﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract]
    public class BianZhiModel
    {
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        private int _OrgID;
        [DataMember]
        public int OrgID
        {
            get { return _OrgID; }
            set { _OrgID = value; }
        }

        private string _ZongBianZhi;
        [DataMember]
        public string ZongBianZhi
        {
            get { return _ZongBianZhi; }
            set { _ZongBianZhi = value; }
        }

        private string _ZongBianZhiShiYou;
        [DataMember]
        public string ZongBianZhiShiYou
        {
            get { return _ZongBianZhiShiYou; }
            set { _ZongBianZhiShiYou = value; }
        }

        private string _ZhengKeLingDao;
        [DataMember]
        public string ZhengKeLingDao
        {
            get { return _ZhengKeLingDao; }
            set { _ZhengKeLingDao = value; }
        }

        private string _ZhengKeLingDaoShiYou;
        [DataMember]
        public string ZhengKeLingDaoShiYou
        {
            get { return _ZhengKeLingDaoShiYou; }
            set { _ZhengKeLingDaoShiYou = value; }
        }

        private string _ZhengKeFeiLingDao;
        [DataMember]
        public string ZhengKeFeiLingDao
        {
            get { return _ZhengKeFeiLingDao; }
            set { _ZhengKeFeiLingDao = value; }
        }

        private string _ZhengKeFeiLingDaoShiYou;
        [DataMember]
        public string ZhengKeFeiLingDaoShiYou
        {
            get { return _ZhengKeFeiLingDaoShiYou; }
            set { _ZhengKeFeiLingDaoShiYou = value; }
        }

        private string _FuKeLingDao;
        [DataMember]
        public string FuKeLingDao
        {
            get { return _FuKeLingDao; }
            set { _FuKeLingDao = value; }
        }

        private string _FuKeLingDaoShiYou;
        [DataMember]
        public string FuKeLingDaoShiYou
        {
            get { return _FuKeLingDaoShiYou; }
            set { _FuKeLingDaoShiYou = value; }
        }

        private string _FuKeFeiLingDao;
        [DataMember]
        public string FuKeFeiLingDao
        {
            get { return _FuKeFeiLingDao; }
            set { _FuKeFeiLingDao = value; }
        }

        private string _FuKeFeiLingDaoShiYou;
        [DataMember]
        public string FuKeFeiLingDaoShiYou
        {
            get { return _FuKeFeiLingDaoShiYou; }
            set { _FuKeFeiLingDaoShiYou = value; }
        }

        private string _KeYuan;
        [DataMember]
        public string KeYuan
        {
            get { return _KeYuan; }
            set { _KeYuan = value; }
        }

        private string _KeYuanShiYou;
        [DataMember]
        public string KeYuanShiYou
        {
            get { return _KeYuanShiYou; }
            set { _KeYuanShiYou = value; }
        }

        private string _WeiDingZhi;
        [DataMember]
        public string WeiDingZhi
        {
            get { return _WeiDingZhi; }
            set { _WeiDingZhi = value; }
        }

        private string _OrgName;
        [DataMember]
        public string OrgName
        {
            get { return _OrgName; }
            set { _OrgName = value; }
        }

        private string _ChuJiRenShu;
        [DataMember]
        public string ChuJiRenShu
        {
            get { return _ChuJiRenShu; }
            set { _ChuJiRenShu = value; }
        }

        private string _KeYiXiaRenShu;
        [DataMember]
        public string KeYiXiaRenShu
        {
            get { return _KeYiXiaRenShu; }
            set { _KeYiXiaRenShu = value; }
        }


        public static BianZhiModel FillEntity(DataRow dr)
        {
            BianZhiModel right = new BianZhiModel();
            right.ID = (int)dr["ID"];
            right.OrgID = (int)dr["OrgID"];
            right.ZongBianZhi = dr["ZongBianZhi"] as string;
            right.ZhengKeLingDao = dr["ZhengKeLingDao"] as string;
            right.FuKeLingDao = dr["FuKeLingDao"] as string;
            right.FuKeFeiLingDao = dr["FuKeFeiLingDao"] as string;
            right.ZhengKeFeiLingDao = dr["ZhengKeFeiLingDao"] as string;
            right.KeYuan = dr["KeYuan"] as string;
            right.OrgName = dr["OrgName"] as string;

            right.ChuJiRenShu = dr["ChuJiRenShu"] as string;
            right.KeYiXiaRenShu = dr["KeYiXiaRenShu"] as string;
            return right;
        }

        public static BianZhiModel FillEntity1(DataRow dr)
        {
            BianZhiModel right = new BianZhiModel();
            right.ZongBianZhiShiYou = string.IsNullOrEmpty(dr["ZongBianShiYou"].ToString())? "0": dr["ZongBianShiYou"].ToString();
            right.ZhengKeLingDaoShiYou = string.IsNullOrEmpty(dr["ZhengKeLingDaoShiYou"].ToString()) ? "0" : dr["ZhengKeLingDaoShiYou"].ToString();
            right.FuKeLingDaoShiYou = string.IsNullOrEmpty(dr["FuKeLingDaoShiYou"].ToString()) ? "0" : dr["FuKeLingDaoShiYou"].ToString();
            right.FuKeFeiLingDaoShiYou = string.IsNullOrEmpty(dr["FuKeFeiLingDaoShiYou"].ToString()) ? "0" : dr["FuKeFeiLingDaoShiYou"].ToString();
            right.ZhengKeFeiLingDaoShiYou = string.IsNullOrEmpty(dr["ZhengKeFeiLingDaoShiYou"].ToString()) ? "0" : dr["ZhengKeFeiLingDaoShiYou"].ToString();
            right.KeYuanShiYou = string.IsNullOrEmpty(dr["KeYuanShiYou"].ToString()) ? "0" : dr["KeYuanShiYou"].ToString();
            right.WeiDingZhi = string.IsNullOrEmpty(dr["WeiDingZhiShiYou"].ToString()) ? "0" : dr["WeiDingZhiShiYou"].ToString();
            right.OrgName = dr["OrgName"] as string;
            right.ZongBianZhi = dr["ZongBianZhi"] as string;
            if (dr.Table != null && dr.Table.Columns.Contains("ChuJiRenShu")) right.ChuJiRenShu = dr["ChuJiRenShu"] as string;
            if (dr.Table != null && dr.Table.Columns.Contains("KeYiXiaRenShu")) right.KeYiXiaRenShu = dr["KeYiXiaRenShu"] as string;
            return right;
        }
    }
}
